package lcr.t32;


class Solution {
    //https://www.bilibili.com/video/BV1YG411p7BA/
    public boolean isAnagram(String s, String t) {
        if (s.equals(t)){
            return false;
        }

        int[] tmp = new int[26];
        for (int i = 0; i < s.length(); i++) {
            tmp[s.charAt(i) - 'a']++;
        }

        for (int i = 0; i < t.length(); i++) {
            tmp[t.charAt(i) - 'a']--;
        }


        for (int i = 0; i < 26; i++) {
            if (tmp[i] != 0) {
                return false;
            }
        }
        return true;
    }
}
